﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using PPIProxy.PPIWebservice;

namespace PPIProxy
{
    public class WUtility_Asset_XMissionStructure_Image
    {
        #region Query
        
        /// <summary>
        /// Get All Images by offset
        /// </summary>
        /// <returns></returns>
        public static DataSet SelectAll(Int32 offset, string connectionKey)
        {
            PPIProxy.PPIWebservice.PPIWebServiceClass serv = new PPIService();
            return serv.Utility_Asset_XMissionStructure_Image_SelectAll(offset, connectionKey);
            

        }

        /// <summary>
        /// get all images associated to the utility
        /// </summary>
        /// <param name="utility"></param>
        /// <returns></returns>
        public static DataSet SelectAllByUtility(Int32 utility, string connectionKey)
        {
            PPIProxy.PPIWebservice.PPIWebServiceClass serv = new PPIService();
            return serv.Utility_Asset_XMissionStructure_Image_SelectAllByUtility(utility, connectionKey);
        }


        #endregion


        #region CRUD

        public static void Disassociate(int imageID, string connectionKey)
        {
            PPIProxy.PPIWebservice.PPIWebServiceClass serv = new PPIService();
            serv.Utility_Asset_XMissionStructure_Image_Disassociate(imageID,connectionKey);
        }

        /// <summary>
        /// Update Utility_Asset_XMissionStructures_PoleFK to null
        /// </summary>
        /// <param name="poleId"></param>
        public static void DisassociatePole(int poleId, string connectionKey)
        {
            PPIProxy.PPIWebservice.PPIWebServiceClass serv = new PPIService();
            serv.Utility_Asset_XMissionStructure_Image_DisassociatePole(poleId, connectionKey);
        }

        /// <summary>
        /// Update Utility_Asset_XMissionStructures_PoleFK to poleId by Utility_Asset_XMissionStructures_ImageId
        /// </summary>
        /// <param name="poleId"></param>
        public static void Associate(int imageId, int poleId, string connectionKey)
        {
            PPIProxy.PPIWebservice.PPIWebServiceClass serv = new PPIService();
            serv.Utility_Asset_XMissionStructure_Image_Associate(imageId,poleId, connectionKey);
        }

        /// <summary>
        /// Insert new Image
        /// </summary>
        /// <param name="vendor_Visit_XMissionStructureFK"></param>
        /// <param name="solutionAvaible"></param>
        /// <param name="fileName"></param>
        /// <param name="bytes"></param>
        /// <param name="latitude"></param>
        /// <param name="altitude"></param>
        /// <param name="longitude"></param>
        /// <param name="satelliteTime"></param>
        /// <param name="satelliteCount"></param>
        /// <param name="direction"></param>
        /// <param name="vendor_Visit_XMissionStructures_PoleID"></param>
        /// <returns></returns>
        public static int Insert(int utilityFk, bool solutionAvaible, string fileName, byte[] bytes, double latitude, double altitude, double longitude, DateTime satelliteTime, int satelliteCount, double direction, int poleFk, string connectionKey)
        {
            PPIProxy.PPIWebservice.PPIWebServiceClass serv = new PPIService();
            return serv.Utility_Asset_XMissionStructure_Image_Insert(utilityFk, solutionAvaible, fileName, bytes, latitude,
                                                              altitude, longitude, satelliteTime, satelliteCount,
                                                              direction, poleFk, connectionKey);

        }

        /// <summary>
        /// Delete image
        /// </summary>
        /// <param name="imageId"></param>
        public static void Delete(Int32 imageId, string connectionKey)
        {
            PPIProxy.PPIWebservice.PPIWebServiceClass serv = new PPIService();
            serv.Utility_Asset_XMissionStructure_Image_Delete(imageId,connectionKey);
        }

        #endregion

    }
}
